<?php
class object_transformer_db {
	protected $_parent;
	protected $_transform;
	
	public function __construct($parent, $transform) {
		$this->_parent = $parent;
		$this->_transform = $transform;
	}
	
	public function __get($var){
		if( in_array($var,$this->_transform) && 
			$method = $this->_transform[$var] && 
			method_exists($this,$method)
		  ) return $this->$method($var);	 
		return $this->_parent->$var;
	}
	
	public function datatime($var) {
		return DataTime::toDB($this->_parent->$var);
	}
	
	public function serialize($var) {
		return serialize($this->_parent->$var);
	}
	
}